package com.qf.j2102.service.impl;


import com.qf.j2102.mapper.SysOrderMapper;
import com.qf.j2102.po.SysOrder;
import com.qf.j2102.service.SysOrderService;
import com.qf.j2102.vo.VOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysOrderServiceImpl implements SysOrderService {


    @Autowired
    private SysOrderMapper orderDao;


    @Override
    public void addOrder(Integer uid, Integer cid, Integer getid, Integer backid, String oprices){

        String status = "已预订";

        double oprice = Double.parseDouble(oprices);
        SysOrder order = new SysOrder();
        order.setUid(uid);
        order.setCid(cid);
        order.setGetid(getid);
        order.setBackid(backid);
        order.setOprice(oprice);
        order.setStatus(status);
            orderDao.insertSelective(order);


    }


    @Override
    public List<VOrder> selectAllV(Integer uid){
        List<VOrder> vOrders = orderDao.selectAll(uid);
        return vOrders;
    }

    @Override
    public int del(Integer id) {
        int del = orderDao.deleteByPrimaryKey(id);
        return del;
    }
}
